<% layout('/layouts/default.html', {title: '考核任务指标汇总表管理', libs: ['layout','validate', 'dataGrid','fileupload']}){ %>
<div class="main-content">
	<div class="box box-main">
		<#form:form id="searchForm1" model="${dcSupExamSumQuotaInfo}" action="${ctx}/quota/dcSupExamSumQuotaInfo/listData" method="post" class="form-inline "
		data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
		<div class="box-header">
			<div class="box-title">
				<#form:hidden path="exameOrg"/>
				<#form:hidden path="examId" />
				<#form:hidden path="examYear" />
				<#form:hidden path="copyVersion" />
				<#form:hidden path="exameOrgName" />
				<#form:hidden path="versionNumber" />
			</div>

			<div class="box-body" style="float: right;margin-bottom: 5px;">
				<div class="form-group">
					<button type="button"  class="btn btn-primary btn-sm" id="batchAdd" title="${text('给左侧被考核单位统一新增考核指标')}"><i class="fa fa-plus">${text('批量新增单项指标')}</i></button>
				</div>
				<p  id="GridAddRowBtn"  style="display: none"></i> 新增指标</p>
				<div class="form-group">
					<button type="button" id="addDataGridAddRowBtn" class="btn btn-primary btn-sm"><i class="fa fa-plus">${text('新增加分项')}</i></button>
				</div>
				<div class="form-group">
					<button type="button" id="subDataGridAddRowBtn"  class="btn btn-primary btn-sm"><i class="fa fa-plus">${text('新增倒扣分项')}</i></button>
				</div>
				<div class="form-group">
					<button type="button" id="hingeDataGridRowBtn"   class="btn btn-primary btn-sm"><i class="fa fa-plus">${text('新增关键指标')}</i></button>
				</div>
				<div class="form-group">
					<button type="button" id="singleDataGridRowBtn" class="btn btn-primary btn-sm"><i class="fa fa-plus">${text('新增单项指标')}</i></button>
				</div>
				<div class="form-group">
					<button type="button"  onclick="confirmData()" id="confirm"  class="btn btn-primary btn-sm"><i class="fa fa-check">${text('确认')}</i></button>
				</div>
			</div>
		</div>
	</#form:form>
		<div class="box-body">
			<table id="dataGrid"></table>
		</div>
	</div>
</div>
<% } %>

<style>
	.gg{
		display: flex;
		width: 100%;
		margin-bottom: 10px;
		height: 40px;
		border-bottom: 1px solid #eeeeee;
		align-items: center;
	}
	.pp{
		width: 80%;
	}
	.col{
		display: flex;
		align-items: center;
		justify-content: right;
	}
	.col1{
		display: flex;
		align-items: center;
		justify-content: right;
		margin: 0 5px 0px 0px;
		overflow: hidden;
	}
	.layui-layer-btn .layui-layer-btn-c{
		float: right;
	}
</style>
<script>
	let addRowInitData={}
	let isPush =${toJson(isPush)};
	let dcSupExamSumQuotaInfo =${toJson(dcSupExamSumQuotaInfo)};


	function refresh(type,orgCode){
		let url_ = window.location.href;
		var arr= url_.split("&");
		var req = arr.slice(0,arr.length -4).join('&');
		let examYear = $("#examYear").val();
		if (type != null){
			if (orgCode == 'success'){
				window.location.replace(req+'&remarks3=1&copyVersion='+type+'&versionNumber='+type + '&examYear=' + examYear);
			}else{
				var request_info = arr.slice(0,arr.length -5).join('&');
				window.location.replace(request_info+'&exameOrg='+orgCode+'&remarks3=1&copyVersion='+type+'&versionNumber='+type + '&examYear=' + examYear);
				$(parent.refreshStyle());
			}
		}else{
			window.location.replace(req+'&versionNumber='+$("#versionNumber").val() + '&remarks3=0' +'&examYear='+examYear);
		}
	}


	$("#quotaType").blur(function (){})



	function getOrgType(){
		let dataList=$('#dataGrid').dataGrid('getRowData');
		return dataList[0].orgType;
	}
	$(function (){
		$("#copyVersion").val($("#versionNumber").val());
		init();
	})
	function init(){
	$('#dataGrid').dataGrid({
		searchForm: $("#searchForm1"),
		columnModel: [
			{header:'${text("主键")}', name:'id', index:'a.id' ,hidden:true,width:65,hidedlg:true},
			{header:'${text("考核任务id")}', name:'examId',hidden:true,width:65,hidedlg:true},
			{header:'${text("指标汇总主表Id")}', name:'sumQuotaId',hidden:true,width:65,hidedlg:true},
			{header:'${text("被考核单位编码")}', name:'exameOrg',hidden:true,width:65,hidedlg:true},
			{header:'${text("被考核单位名称")}', name:'exameOrgName',hidden:true,width:65,hidedlg:true},
			{header:'${text("区县类型")}', name:'orgType',hidden:true,width:65,hidedlg:true},
			{header:'${text("指标分类")}', name:'quotaClass',hidden:true,width:65,hidedlg:true},
			{header:'${text("考核年度")}', name:'examYear', index:'a.exam_year', width:65, align:"center",hidden:true,width:65,hidedlg:true,
				edittype:'text', editoptions:{'maxlength':'200', 'class':'form-control required '},
				unformat: function(val, obj, cell){
					return $('#'+obj.rowId+'_examYear').val();
				}},
			{header:'${text("指标类型")}', name:'quotaGroup', index:'a.quota_group', width:80, align:"center",hidden:true,width:65,hidedlg:true,
				editable:true, edittype:'text', editoptions:{'maxlength':'200', 'class':'form-control required '},
				unformat: function(val, obj, cell){
					return $('#'+obj.rowId+'_quotaGroup').val();
				}
			},
			{header:'${text("指标类别")}', name:'quotaType', index:'a.quota_type', width:120, align:"center",
				formatter: function(val, obj, row, act){
					if (row.id == null){
						if ( val == "13"){
							return 	obj.colModel.editoptions.items=[{dictLabel:'倒扣分项',dictValue:'13'}];
						}else if ( val == '14'){
							return  obj.colModel.editoptions.items=[{dictLabel:'加分项',dictValue:'14'}];
						}else if ( val == '11'){
							return obj.colModel.editoptions.items=[{dictLabel:'单项指标',dictValue:'11'}];
						}else{
							obj.colModel.editoptions.items=${@DictUtils.getDictListJson('dc_quotaType_guanjian')};
							return js.getDictLabel(${@DictUtils.getDictListJson('dc_quotaType_guanjian')},
									val, '${text("未知")}', true);
						}
					}else{
						obj.colModel.editoptions.items=${@DictUtils.getDictListJson('dc_quotaType')};
						return js.getDictLabel(${@DictUtils.getDictListJson('dc_quotaType')},
								val, '${text("未知")}', true);
					}
				},
				unformat: function(val, obj, cell){
					return $('#'+obj.rowId+'_quotaType').val();
				},
				editable:true, edittype:'select', editoptions:{'class':'form-control required ',
					items: ${@DictUtils.getDictListJson('dc_quotaType')},
					itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){
						$(element).select2().on("change",function(){$(this).resetValid()});
					}
				}
			},
			{header:'${text("序号")}', name:'sortNum', index:'a.sort_num', width:50, align:"center",
				editable:true, edittype:'text', editoptions:{'maxlength':'200', 'class':'form-control'},
				unformat: function(val, obj, cell){
					return $('#'+obj.rowId+'_sortNum').val();
				}
			},
			{header:'${text("目标内容")}', name:'quotaContent', index:'a.quota_content', width:390, align:"left",
				editable:true, edittype:'text', editoptions:{'maxlength':'200', 'class':'form-control '},
				unformat: function(val, obj, cell){
					return $('#'+obj.rowId+'_quotaContent').val();
				}
			},
			{header:'${text("单位")}', name:'quotaUnit', index:'a.quota_unit', width:60, align:"center",
				editable:true, edittype:'text', editoptions:{'maxlength':'200', 'class':'form-control'},
				unformat: function(val, obj, cell){
					return $('#'+obj.rowId+'_quotaUnit').val();
				}
			},
			{header:'${text("权数")}', name:'quotaWeight', index:'a.quota_weight', width:60, align:"center", placeholder:"请输入数字",
				formatter: function(val, obj, row, act){
				if(val != null){
					return parseFloat(val).toFixed(2);
				}
				return 0.00;
				},
				editable:true, edittype:'text', editoptions:{'maxlength':'200', 'class':'form-control',
					dataInit: function(element){
						$(element).on("input",function (e){
							refreshZpCount(2);
						})
					}
				},
				unformat: function(val, obj, cell){
					return $('#'+obj.rowId+'_quotaWeight').val();
				}
			},
			{header:'${text("考核方式")}', name:'assessMethod', index:'a.assess_method', width:90, align:"center",
				formatter: function(val, obj, row, act){
					return val;
				},
				unformat: function(val, obj, cell){
					return $('#'+obj.rowId+'_assessMethod').val();
				},
				editable:true, edittype:'select', editoptions:{'class':'form-control required ',
					items: $.merge([{dictLabel:'&nbsp;',dictValue:' '}], ${@DictUtils.getDictListJson('dc_exam_assessment')}),
					itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){
						$(element).select2().on("change",function(){$(this).resetValid()});
					}
				}
			},
			{header:'${text("本年度目标")}', name:'currentYaerGoal', index:'a.current_yaer_goal', width:65, align:"center",
				editable:true, edittype:'text', editoptions:{'maxlength':'200', 'class':'form-control'},
				unformat: function(val, obj, cell){
					return $('#'+obj.rowId+'_currentYaerGoal').val();
				}
			},
			{header:'${text("上一年度目标任务")}', name:'lastYaerGoal', index:'a.last_yaer_goal', width:65, align:"center",
				editable:true, edittype:'text', editoptions:{'maxlength':'200', 'class':'form-control'},
				unformat: function(val, obj, cell){
					return $('#'+obj.rowId+'_lastYaerGoal').val();
				}
			},
			{header:'${text("上一年度完成情况")}', name:'lastYearComplete', index:'a.last_year_complete', width:65, align:"center",
				editable:true, edittype:'text', editoptions:{'maxlength':'200', 'class':'form-control'},
				unformat: function(val, obj, cell){
					return $('#'+obj.rowId+'_lastYearComplete').val();
				}
			},
			{header:'${text("备注")}', name:'remarks', index:'a.remarks', width:80, align:"center",
				formatter: function(val, obj, row, act){
					return val;
				},
				unformat: function(val, obj, cell){
					return $('#'+obj.rowId+'_remarks').val();
				},
				editable:true, edittype:'select', editoptions:{'class':'form-control required ',
					items: ${@DictUtils.getDictListJson('dc_exam_remarks')},
					itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){
						$(element).select2().on("change",function(){$(this).resetValid()});
					}
				}
			},
			{header:'${text("考核评分单位")}', name:'gradeOrg',width:130, align:"center",
				formatter: function(val, obj, row, act){
					//if (row.quota_group == '2' && row.gradeOrg !=null){
						return js.val(row, 'gradeOrg')+'|'+js.val(row, 'gradeOrgName');
				},
				unformat: function(val, obj, cell){
					var str = cell.childElementCount;
					if (cell.childElementCount > 0) {
						var exameOrgCode= $('#office_'+obj.rowId+'_gradeOrgCode', cell).val();
						var exameOrgName= $('#office_'+obj.rowId+'_gradeOrgName', cell).val();
						return exameOrgCode + '|' + exameOrgName;
					}
					return cell.outerText;
				},
				editable: true, edittype: "custom", editoptions: {
					custom_element: function(val, editOptions) {
						if (val.split('|')[0] == "undefined" && val.split('|')[1] == "undefined") {
							val = "|"
						}
						return js.template('treeselectTpl', {
							id:'office_'+editOptions.id,  title: '考核评分单位',type:"text",
							name: 'gradeOrgCode', value: val.split('|')[0],
							labelName: 'gradeOrgName', labelValue: val.split('|')[1],
							url: '${ctx}/quota/dcSupExamSumQuotaInfo/selectOrgs?excludeCode='+$("#exameOrg").val(), cssClass: ''
						});
					},
					dataInit: function(element){
						// 关键指标 评分单位不允许修改
						chooseToBan();
					}
				}
			},{header:'${text("指标类型")}', name:'type', width:100,
				editable:true, edittype:'select', editoptions:{'class':'form-control',
					items:[{dictLabel:'单项指标',dictValue:'1'},{dictLabel:'关键指标',dictValue:'2'},{dictLabel:'加分指标',dictValue:'3'},{dictLabel:'减分指标',dictValue:'4'}],
					itemLabel: 'dictLabel', itemValue: 'dictValue',
					dataInit: function(element){
						$(element).select2().on("change",function(){$(this).resetValid()}
						);
					}
				},
				formatter: function(val, obj, row, act){
					if (val ==null){
						obj.colModel.edittype="text";
						obj.colModel.align="center";
						obj.colModel.editable=false;
						if (row.quotaClass=='1' && row.quotaGroup =='1'){
							return '关键指标';
						}else if(row.quotaGroup =='2'){
							return '单项指标';
						}else{
							return '其它';
						}
					}else{
						obj.colModel.edittype="select";
						if (val == '1'){
							obj.colModel.editoptions.items=[{dictLabel:'单项指标',dictValue:'1'}];
						}else if (val == '3'){
							obj.colModel.editoptions.items=[{dictLabel:'单项指标',dictValue:'3'}];
						}else if (val == '2'){
							obj.colModel.editoptions.items=[{dictLabel:'关键指标',dictValue:'2'}];
						}else if (val == '4'){
							obj.colModel.editoptions.items=[{dictLabel:'单项指标',dictValue:'4'}];
						}
						obj.colModel.editable=true;
					}
				},
				unformat: function(val, obj, cell){
					return $('#'+obj.rowId+'_type').val();
				}
			},
			{header:'${text("操作")}', name:'actions', align:"center",width:55, formatter: function(val, obj, row, act){
					var actions = [];
					if (val=="new"){
						actions.push('<a href="#" onclick="js.confirm(\'${text("你确认要删除这条数据吗？")}\', function(){$(\'#dataGrid\').dataGrid(\'delRowData\',\''+obj.rowId+'\'); });return false;">删除</a>&nbsp;');
					}else{
						actions.push('<a href="javascript:void(0);" onclick="del(\''+(row.id)+'\')" title="${text("删除考核指标")}">删除</a>&nbsp;');
					}
					return actions.join('');
				}, editoptions: {defaultValue: 'new'}}
		],
		editGrid: true,       // 是否是编辑表格
		editGridAddRowBtn: $('#GridAddRowBtn'), // 子表增行按钮
		editGridInitAllRowEdit: true,  // 是否初始化就编辑所有行（*** 重点 ***）
		showRownum: false,
		editGridAddRowInitData: function (e){

			return addRowInitData;
		},
		// 新增行的时候初始化的数据
		autoGridHeight: function(){return 'auto'},
		onSelectRow: function(id, isSelect, event){

		},
		showFooter: true, // 是否显示底部合计行
		// 加载成功后执行事件
		ajaxSuccess: function(data){
			var info = $('#dataGrid').dataGrid('getRowData');
			$(parent.document.getElementById("dataInfo")).val(JSON.stringify(info))
			refreshZpCount(1);
		}
	});
	}

	function del(id){
		layer.open({
			type: 1
			,title: ['信息', 'font-size:15px; color:orange;font-weight:bold;']
			,btn: ['确认', '取消']
			,btnAlign: 'c'
			,area: '300px;'
			,moveType: 1 //拖拽模式，0或者1
			,content: "<div style=\"padding: 50px\"><i class='layui-layer-ico layui-layer-ico3' style='width: 30px;height: 30px;'></i>确认要删除该考核指标吗？</div>"
			,yes: function(layero){
				js.ajaxSubmit(
						'${ctx}/quota/dcSupExamSumQuotaInfo/delete?id='+id,
						function (data){
							if (data.result == "true"){
								js.showMessage("删除成功");
								$("#searchForm1").submit();
							}else{
								js.showMessage("删除失败")
							}
						});
			}
		});

	}

	function chooseToBan(){
		let allData =$('#dataGrid').dataGrid('getRowData');
		if (allData.length > 0){
			let  index = 1;
			for(let key in allData){
				let row = allData[key];
				if ((row.quotaClass=='1' && row.quotaGroup =='1') || (row.quotaClass=='1' && row.type =='2')){
					if (row.id == ''){
						$('#office_jqg'+(index)+'_gradeOrgName').attr("disabled",true)
						$('#office_jqg'+(index)+'_gradeOrgButton').attr("disabled",true).css("pointer-events","none")
					}else{
						$('#office_'+row.id+'_gradeOrgName').attr("disabled",true)
						$('#office_'+row.id+'_gradeOrgButton').attr("disabled",true).css("pointer-events","none")
					}
				}
				if (row.id == ''){
					index = index +1;
				}
			}
		}
	}


	function accAdd(arg1,arg2){
		var r1,r2,m;
		try{r1=arg1.toString().split(".")[1].length}catch(e){r1=0}
		try{r2=arg2.toString().split(".")[1].length}catch(e){r2=0}
		m=Math.pow(10,Math.max(r1,r2))
		return (arg1*m+arg2*m)/m
	}

	function refreshZpCount(index){
		let data = $('#dataGrid').dataGrid('getRowData');
		let allQuotaWeight=0;
		let subScore=0;
		let addScore=0;
		let orgType = 99;
		for (let i = 0; i < data.length; i++) {
			if (data[i].quotaWeight == 'undefined' ||data[i].quotaWeight==''){
				continue;
			}
			if ((data[i].quotaType == "加分项" || data[i].quotaType == "14")&& data[i].quotaClass == '2'){
				addScore=accAdd(parseFloat(data[i].quotaWeight||0),addScore);
			}else if((data[i].quotaType == "倒扣分项" || data[i].quotaType == "13") && data[i].quotaClass == '3'){
				subScore=accAdd(parseFloat(data[i].quotaWeight||0),subScore);
			}else{
				allQuotaWeight=accAdd(parseFloat(data[i].quotaWeight||0),allQuotaWeight);
			}
			orgType=data[i].orgType;
		}
		if (index == 2){
			if (orgType != 99){
				if (orgType == '1' && allQuotaWeight >150){
					js.showMessage("区县权数总分不能超过150分,当前权数总分:"+ allQuotaWeight);
				}else if (orgType == '2'  && allQuotaWeight >100){
					js.showMessage("市直单位权数总分不能超过100分,当前权数总分:"+ allQuotaWeight);
				}else if (orgType == '' || orgType == null){
					js.showMessage("机构区县类型有误");
				}
				if (addScore >3){
					js.showMessage("加分指标权数总分不能超过3分,当前加分指标权数总分:"+ addScore);
				}
			}
		}
		$('#dataGrid').dataGrid("footerData", "set", {
			"quotaType" : "<center><span>汇总：</span></center>",
			"quotaContent" : "(单项+关键)总权数：<span>"+parseFloat(allQuotaWeight).toFixed(2)+"</span>分",
			"assessMethod" : "<span>倒扣分总权数:</span>",
			"currentYaerGoal" : "<span>"+parseFloat(subScore).toFixed(2)+"</span>分",
			"gradeOrg": "<span>加分项总权数：</span>",
			"type": "<span>"+parseFloat(addScore).toFixed(2)+"</span>分"
		}, false);

	}

	function checkParamIsNull(i,data,type){
		var content="";
		if (data.quotaType ==''){
			content = content +"[指标类别] 不能为空;"
		}
		if (data.quotaWeight ==''){
			content = content +"[权数] 不能为空;"
		}
		if (data.sortNum ==''){
			content = content +"[序号] 不能为空;"
		}
		if (data.quotaContent ==''){
			content = content +"[目标内容] 不能为空;"
		}
		if (data.gradeOrg =='' || data.gradeOrg =='|'){
			content = content +"[考核评分单位] 不能为空;"
		}

		if (type == 1){
			if (data.currentYaerGoal ==''){
				content = content +"[本年度目标] 不能为空;"
			}
		}
		if ( data.quotaGroup !='1'){
			if (data.assessMethod == ' '){
				content = content +"[考核方式] 不能为空;"
			}
		}
		if (content != ''){
			content = "第" +(i)+"行 "+content +'\n';
		}
		return content;
	}


	function confirmData() {
		var data= $('#dataGrid').dataGrid('getRowData');
		var sumScore = 0.0;
		var addScore = 0.0;
		var content =[];
		let orgType= getOrgType();
		var index_ = 0;
		var checkContent="";
		for (var o in data){
			index_++;
			// 加分项
			if (data[o].quotaType == '14'){
				data[o].quotaClass="2";
				data[o].quotaGroup="2";
			}else if (data[o].quotaType == '13'){
				data[o].quotaClass="3";
				data[o].quotaGroup="2";
			}else if (data[o].quotaType == '11'){
				data[o].quotaClass="1";
				data[o].quotaGroup="2";
			}else{
				data[o].quotaClass="1";
				data[o].quotaGroup="1";
			}
			// 加分项指标 和 倒扣分项指标  本年度目标 和 备注 非必填
			if (data[o].id == '' && (data[o].type == '3' || data[o].type== '4')){
				if (data[o].quotaType ==''
						|| data[o].quotaWeight == ''
						|| data[o].sortNum == ''
						|| data[o].quotaContent == ''
						|| data[o].assessMethod == ''
						|| data[o].gradeOrg == ''
						|| data[o].gradeOrg == '|'){
					//js.showMessage("请检查指标类别、目标内容、序号、权数以及考核评分单位字段是否填写！")
					checkContent =checkContent+	checkParamIsNull(index_,data[o],2);
					continue;
				}

			}else{
				if (    data[o].quotaType ==''
						|| data[o].quotaWeight == ''
						|| data[o].sortNum == ''
						|| data[o].quotaContent == ''
						|| data[o].currentYaerGoal == ''
						|| data[o].assessMethod == ''
						|| data[o].gradeOrg == ''
						|| data[o].gradeOrg == '|'
						|| data[o].remarks == ''
				){
					//js.showMessage("请检查指标类别、目标内容、序号、权数、本年度目标、备注以及考核评分单位字段是否填写！")
					checkContent =checkContent+	checkParamIsNull(index_,data[o],1);
					continue;
				}
			}
			if (Number( data[o].sortNum) < 1){
				if (checkContent!= '') {
					checkContent = checkContent  + "[序号] 不能小于1;"
				}else{
					checkContent = checkContent + "第" + index_ + "行 " + "[序号] 不能小于1;"
				}
			}
			if (data[o].quotaClass=='1'){
				sumScore=accAdd(parseFloat(data[o].quotaWeight||0),sumScore);
			}else if(data[o].quotaClass=='2'){
				addScore=accAdd(parseFloat(data[o].quotaWeight||0),addScore);
			}
			// 目标内容匹配是否相等
			if (data[o].id ==''){
				if (content.indexOf(data[o].quotaContent.trim()) !== -1 ){
					js.showMessage("目标内容存在相同!")
					return;
				}
			}
			content.push(data[o].quotaContent.trim())
		}
		if (checkContent != ''){
			js.showMessage( checkContent );
			return;
		}
		if (orgType == '' || orgType == null){
			js.showMessage("机构区县类型有误");
			return;
		}
		if (addScore >3){
			js.showMessage("加分指标权数总分不能超过3分,当前加分指标权数总分:"+ addScore);
			return;
		}
		let allData = JSON.stringify($('#dataGrid').dataGrid('getRowData'));
		let dcSupExamSumQuotaInfoList = {"dcSupExamSumQuotaInfoList": allData}
		js.ajaxSubmit({
			url: "${ctx}/quota/dcSupExamSumQuotaInfo/saveStrSumList",
			data: dcSupExamSumQuotaInfoList,
			dataType: 'json',
			callback: function (data) {
				if (data.result == "true") {
					js.showMessage(data.message);
					$("#searchForm1").submit();
				} else {
					js.showMessage(data.message);
				}
			}
		})
	}

	//新增关键指标
	$('#hingeDataGridRowBtn').click(function (){
		let allData =$('#dataGrid').dataGrid('getRowData');
		var len = allData.length+1;
		addRowInitData={examYear:$("#examYear").val(),examId:$("#examId").val(),quotaClass:"1",quotaGroup:"1",orgType:getOrgType(),exameOrg:$("#exameOrg").val(),exameOrgName:$("#exameOrgName").val(),gradeOrg:'241',gradeOrgName:'市委督查办公室（市政府督查办公室）',type:'2',rowno:len,quotaWeight:"0"};
		$('#GridAddRowBtn').click();
	})

	//新增单项指标
	$('#singleDataGridRowBtn').click(function (){
		let allData =$('#dataGrid').dataGrid('getRowData');
		var len = allData.length+1;
		addRowInitData={examYear:$("#examYear").val(),examId:$("#examId").val(),quotaClass:"1",orgType:getOrgType(),exameOrg:$("#exameOrg").val(),exameOrgName:$("#exameOrgName").val(),quotaType:'11',type:'1',rowno:len,quotaWeight:"0"};
		$('#GridAddRowBtn').click();
	})

	// //新增加分项指标
	$('#addDataGridAddRowBtn').click(function (){
		let allData =$('#dataGrid').dataGrid('getRowData');
		var len = allData.length+1;
		addRowInitData={examYear:$("#examYear").val(),examId:$("#examId").val(),quotaClass:"2",orgType:getOrgType(),exameOrg:$("#exameOrg").val(),exameOrgName:$("#exameOrgName").val(),quotaType:'14',type:'3',rowno:len,quotaWeight:"0"};
		$('#GridAddRowBtn').click();
	})

	// //新增倒扣分指标
	$('#subDataGridAddRowBtn').click(function (){
		let allData =$('#dataGrid').dataGrid('getRowData');
		var len = allData.length+1;
		addRowInitData={examYear:$("#examYear").val(),examId:$("#examId").val(),quotaClass:"3",orgType:getOrgType(),exameOrg:$("#exameOrg").val(),exameOrgName:$("#exameOrgName").val(),quotaType:'13',type:'4',rowno:len,quotaWeight:"0"};
		$('#GridAddRowBtn').click();
	})


	$("#batchAdd").click(function (){
		// 版本号不能为空
		let version=$("#versionNumber").val();
		if (version == ' ' || version == null){
			js.showMessage("请选择对应的版本进行添加")
			return;
		}
		layer.open({
			type: 1
			,title: ['温 馨 提 示', 'font-size:18px; color:orange;']
			,btn: ['确认', '取消']
			,btnAlign: 'c'
			,area: '500px;'
			,moveType: 1 //拖拽模式，0或者1
			,content: "<div style=\"padding: 50px\">进行此操作前如有修改或添加的数据,请先保存,以免数据丢失!!!</div>"
			,yes: function(layero){
				js.addTabPage(null, "新增指标","${ctx}/quota/dcSupExamSumQuotaInfo/batchAddQuota?examId=${dcSupExamSumQuotaInfo.examId}&examYear=${dcSupExamSumQuotaInfo.examYear}&versionNumber="+version, true);
			}
		});
	})





</script>
<script id="treeselectTpl" type="text/template">//<!--<div>
<#form:treeselect id="{{d.id}}" title="{{d.title}}" name="{{d.name}}" value="{{d.value}}"
	labelName="{{d.labelName}}" labelValue="{{d.labelValue}}" url="{{d.url}}"
	 class="{{d.cssClass}}" isReturnValue="false" allowClear="true" canSelectRoot="true" canSelectParent="true"
        returnFullName="false" checkbox="false" chkboxType="{'Y':'','N':''}" btnClass="btn-sm"
        placeholder="选择考核评分单位"/>
</div>//--></script>
<!--<% if(hasPermi('quota:dcSupExamSumQuotaInfo:edit')){ %>-->
<!--<% } %>-->